<template>
  <div class="block">
    <transition
      appear
      name="animate__animated animate__backOutUp"
      enter-active-class="animate__fadeIn"
    >
      <el-carousel height="43rem" style="top: 50px;width: 100%;">
        <el-carousel-item v-for="img in imgs" :key="img.imgUrl">
          <h3>
            <img :src="img.imgUrl" width="100%" />
            <span style="letter-spacing: 3px">{{ img.sentence }}</span>
            <span style="font-size: 1.2rem; top: 75%">{{ img.eng }}</span>
          </h3>
        </el-carousel-item>
      </el-carousel>
    </transition>
  </div>
</template>

<script>
export default {
  name: "Slide",
  data() {
    return {
      imgs: [
        {
          imgUrl: require("../assets/sg1.jpg"),
          sentence: "创造力是智慧的乐趣。",
          eng: "Creativity is the joy of intelligence.",
        },
        {
          imgUrl: require("../assets/sg2.jpg"),
          sentence: "惟坚韧者始能遂其志。",
          eng: "Only those who persevere can achieve their goals.",
        },
        {
          imgUrl: require("../assets/sg3.jpg"),
          sentence: "苟日新，日日新，又日新。",
          eng: "Every second should be created.",
        },
      ],
    };
  },
};
</script>

<style scoped>

.el-carousel__item h3 {
  color: #fff;
  font-weight: lighter;
  font-size: 2rem;
  opacity: 0.9;
  line-height: 150px;
  margin: 0;
  text-align: end;
  letter-spacing: 1px;
}

.el-carousel__item h3 span {
  /* z-index: 999; */
  position: absolute;
  top: 70%;
  left: 65%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  color: #fff;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>
